<template>
  <div class="bar">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span style="font-size:14px;border-left:6px solid #409eff;padding-left:6px;">项目总览</span>
      </div>
      <div class="flex">
        <dl class="flex-1">
          <dt class="iconfont icon-dikuai" />
          <dd class="number">{{ firstData.projects }}</dd>
          <dd>项目总数</dd>
        </dl>
        <dl class="flex-1">
          <dt class="iconfont icon-baohunongyeyongdiguanli" />
          <dd class="number">{{ firstData.area }}</dd>
          <dd>灌溉面积(亩)</dd>
        </dl>
        <dl class="flex-1">
          <dt class="iconfont icon-device" />
          <dd class="number">{{ firstData.devices }}</dd>
          <dd>设备总数</dd>
        </dl>
      </div>
    </el-card>
    <div class="h12" />
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span style="font-size:14px;border-left:6px solid #67c23a;padding-left:6px;">设备统计</span>
      </div>
      <div>
        <devices :chart-data="deviceData" />
      </div>
    </el-card>
    <div class="h12" />
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span style="font-size:14px;border-left:6px solid #67c23a;padding-left:6px;">土壤墒情统计</span>
      </div>
      <div style="height:168px;">
        <el-empty style="padding-top:0;" />
      </div>
    </el-card>
    <!-- <div class="h12" />
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span style="font-size:14px;border-left:6px solid #f56c6c;padding-left:6px;">系统消息</span>
      </div>
      <div class="page-example3">
        <vue-seamless-scroll :data="listData" :class-option="defaultOption">
          <ul class="ul-scoll">
            <li v-for="(item, index) in listData" :key="index">
              <span class="title">{{ item.title }}：</span><span class="date">{{ item.time }}</span>
            </li>
          </ul>
        </vue-seamless-scroll>
      </div>
    </el-card> -->
  </div>
</template>

<script>
import Devices from './devices'
export default {
  components: {
    Devices
  },
  props: {
    dashboardData: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  data() {
    return {
      listData: []
    }
  },
  computed: {
    firstData() {
      return this.dashboardData.first || {}
    },
    deviceData() {
      return {
        columns: ['name', '设备数量'],
        rows: this.dashboardData.second || []
      }
    },
    defaultOption() {
      return {
        step: 0.6, // 数值越大速度滚动越快
        limitMoveNum: 2, // 开始无缝滚动的数据量 this.dataList.length
        hoverStop: true, // 是否开启鼠标悬停stop
        direction: 1, // 0向下 1向上 2向左 3向右
        openWatch: true, // 开启数据实时监控刷新dom
        singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
        singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
        waitTime: 1000 // 单步运动停止的时间(默认值1000ms)
      }
    }
  },
  mounted() {
    for (let i = 0; i < 15; i++) {
      const j = {
        title: '电磁阀2023打开-' + i,
        time: '2023-08-10'
      }
      this.listData.push(j)
    }
  },
  methods: {

  }
}
</script>

<style lang="scss" scoped>
.page-example3{

  height: 180px;
  overflow: hidden;
  .ul-scoll{
    margin-block-start:0;
    padding-inline-start:0;
      li{
        list-style:none;
          margin: 6px 0;
          padding: 5px;
          font-size:14px;
      }
  }
}
.bar{
  position:absolute;
  border-top:1px solid #ddd;
  width:400px;
  padding:12px;
  height:100%;
  background:white;
  left:0;
  top:0;
  z-index:1999;
}
.flex-1{
  text-align:center;
  dt{
    height:32px;
    line-height:32px;
    &.icon-dikuai{
      font-size:24px;
      color:#409eff;
    }
    &.icon-device{
      font-size:28px;
      color:#67c23a;
    }
    &.icon-baohunongyeyongdiguanli{
      font-size:32px;
      color:#999;
    }
  }
  dd{
    font-size:14px;
    &.number{
      font-size: 18px;
      font-weight: 720;
      color: var(--color-95);
      margin: 10px 0;
    }
  }
}

</style>
